<template>

    <div class="banner">
        <div class="title">
            <div @click="is(item)" :class="{cor:item==$store.state.isOneTitle}" v-for="item in listFilter" :key="item">
                <router-link :to="'/list'+item">{{item}}</router-link>
            </div>
        </div>
        <!-- <p>{{listFilter}}</p> -->
    </div>

</template>

<script>
export default {
    props: {},
    data() {
        return {
            list: [],
            isShow: "",
            al: "",
        };
    },
    async created() {
        let list = await this.$API.HomeAPI.GetTypeOne();
        this.list = list;
    },
    computed: {
        listFilter() {
            return this.list.filter((item, index) => index < 9);
        },
    },
    methods: {
        is(item) {
            console.log(item);
            if (this.ar == item) {
                console.log(item);
            } else {
                // this.$router.push("/list" + item);
                // this.ar = item;
                this.$store.commit("SET_isOneTitle", item);
            }
        },
    },
};
</script>

<style lang="scss" scoped>
.banner {
    margin: 0 auto;
    .title {
        width: 1080px;
        height: 50px;
        padding: 5px;
        display: flex;
        margin: 0 auto;
        div {
            text-decoration: none;
            line-height: 40px;
            display: inline-block;
            width: 100px;
            text-align: center;
            border-radius: 50%;
            a {
                display: inline-block;
                width: 100px;
                border-radius: 50%;
                line-height: 40px;
                text-decoration: none;
            }
        }
        div:hover {
            color: wheat;
            background-color: #784cfa;
        }
    }
}
.cor {
    background-color: #784cfa;
    color: wheat;
}
</style>